package io.litchi.auth.domain.entity.auth;

import io.litchi.common.base.BaseEntity;
import jakarta.persistence.*;
import lombok.*;
import lombok.experimental.FieldDefaults;
import org.hibernate.annotations.Comment;

/**
 * description: 菜单权限表
 *
 * @author helang
 * @since 2025-09-18
 */
@Entity
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
@FieldDefaults(level = AccessLevel.PRIVATE)
@EqualsAndHashCode(callSuper = false, of = "id")
@Table(name = "menu_perm")
@Comment("权限菜单表")
public class MenuPerm extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false,
            columnDefinition = "BIGINT(20) COMMENT 'id'")
    Long id;

    @Column(name = "pid", columnDefinition = "BIGINT(20) DEFAULT 0 COMMENT '父级id'")
    Long pid;

    @Column(name = "level", columnDefinition = "TINYINT(1) DEFAULT 0 COMMENT '树形层级' ")
    Integer level;

    @Column(name = "type", columnDefinition = "TINYINT(1) COMMENT '0菜单 1权限'")
    Integer type;

    @Column(name = "title", columnDefinition = "VARCHAR(64) COMMENT '标题'")
    String title;

    @Column(name = "permission", columnDefinition = "VARCHAR(128) COMMENT '权限值'")
    String permission;

    @Column(name = "permission_level", columnDefinition = "TINYINT(1)  COMMENT '权限等级,0页面级控制 1组件级控制 2元素级控制'")
    Integer permissionLevel;

    @Column(name = "icon", columnDefinition = "VARCHAR(64) COMMENT '菜单 图标'")
    String icon;

    @Column(name = "route", columnDefinition = "VARCHAR(128) COMMENT '路由地址'")
    String route;

    @Column(name = "status",columnDefinition = "INT DEFAULT 1 COMMENT '状态 1启用 0禁用'")
    Integer status;


}